package me.hellp.helloworld.design.factory;

/**
 * 静态简单工厂
 * 
 * @author linxm
 *
 */
public class SimpleFactory {
    private static final int TYPE_APP = 		1;	//	苹果
    private static final int TYPE_ORANGE = 	2;	//	橘子
    private static final int TYPE_BANBANA = 	3;	//	香蕉

    public static Fruit createFruit(int type) {
        switch (type) {
            case TYPE_APP:
                return new Apple();
            case TYPE_ORANGE:
                return new Orange();
            case TYPE_BANBANA:
            default:
                return new Banana();
        }
    }
}
